<script setup lang="ts">
/**
 * @desc NodeBasic
 * @author DragonTeam <https://www.bpmport.com>
 * @since 2024/10/28 14:09
 */

import type { PropType } from 'vue'
import { computed, ref, watchEffect } from 'vue'

import { Command } from 'lucide-vue-next'
import type { BaseNode, ExpressionNode } from '@/types'
import { isUndefined } from '@/utils/typed'

defineOptions({ name: 'NodeBasic' })
const $props = defineProps({
  node: {
    type: Object as PropType<BaseNode>,
    required: true,
  },
})
const doEmit = defineEmits(['update:node'])
const vModelNode = computed<BaseNode>({
  get: () => $props.node,
  set: val => doEmit('update:node', val),
})

// 名称
const nameDisabled = computed(() => $props.node.businessData.$type === 'startEvent' || $props.node.businessData.$type === 'endEvent')
</script>

<template>
  <a-collapse-item key="NodeBasic">
    <template #header>
      <Command :size="16" />
      基础信息
    </template>

    <EditItem label="ID">
      <validate-input v-model="vModelNode.id as string" disabled />
    </EditItem>
    <EditItem label="名称">
      <validate-input v-model="vModelNode.name as string" :disabled="nameDisabled" />
    </EditItem>
  </a-collapse-item>
</template>
